var app = getApp()
Component({
  data: {
    feiBox: "",
    hide_good_box: true,
  },
  properties: {},
  methods: {
    //开始动画
    startAnimation: function(e) {
      var index = 0,
          that = this,
          bezier_points = that.linePos['bezier_points'];
      this.setData({
          hide_good_box: false,
          bus_x: that.finger['x'],
          bus_y: that.finger['y']
      })
      this.timer = setInterval(function() {
          index++;
          that.setData({
              bus_x: bezier_points[index]['x'],
              bus_y: bezier_points[index]['y']
          })
          if (index >= 28) {
              clearInterval(that.timer);
              that.setData({
                  hide_good_box: true,
                  hideCount: false,
                  count: that.data.count += 1
              })
          }
          
      }, 33);
      // 等动画执行完再执行加入购物车
      setTimeout(()=>{
          this.addShop(e)
      }
      ,1000)
    },
  },
  onLoad() {
    var that = this;
    //可视窗口x,y坐标
    this.busPos = {};
    console.log(app.globalData.ww);
    this.busPos['x'] = 45;
    this.busPos['y'] = app.globalData.hh ;
  },
})